package de.argh.jteas.mojo.model;

import java.util.ArrayList;
import java.util.List;

import de.argh.jteas.mojo.model.annotation.ASClassAnnotation;

public class ASClass {

	private ASClassAnnotation annotation;
	private String packageName;
	private String name;
	private ASClass extender;
	private List<ASInterface> interfaces;
	private List<ASField> fields;
	private String[] fieldOrder;
	private boolean enumeration;
	

	public ASClass() {
		enumeration = false;
	}

	public ASClass(String fullName) {
		this();
		if (fullName.indexOf(".") >= 0) {
			packageName = fullName.substring(0, fullName.lastIndexOf("."));
			name = fullName.substring(fullName.lastIndexOf(".")+1);
		} else {
			name = fullName;
		}
		
	}

	public ASClass(boolean isEnumeration) {
		enumeration = isEnumeration;
	}

	public ASClass(String fullName, boolean isEnumeration) {
		this(fullName);
		enumeration = isEnumeration;
	}

	public String getFullName() {
		return packageName + "." + name;
	}
	
	public void setAnnotation(ASClassAnnotation annotation) {
		this.annotation = annotation;
	}
	
	public ASClassAnnotation getAnnotation() {
		return annotation;
	}

	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}

	public String getPackageName() {
		return packageName;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setExtender(ASClass extender) {
		this.extender = extender;
	}

	public ASClass getExtender() {
		return extender;
	}

	public void setInterfaces(List<ASInterface> interfaces) {
		this.interfaces = interfaces;
	}

	public List<ASInterface> getInterfaces() {
		if (interfaces == null) {
			interfaces = new ArrayList<ASInterface>();
		}
		return interfaces;
	}

	public List<ASField> getFields() {
		if (fields == null) {
			fields = new ArrayList<ASField>();
		}
		return fields;
	}

	public void setFieldOrder(String[] fieldOrder) {
		this.fieldOrder = fieldOrder;
	}

	public String[] getFieldOrder() {
		return fieldOrder;
	}

	public void setEnumeration(boolean enumeration) {
		this.enumeration = enumeration;
	}

	public boolean isEnumeration() {
		return enumeration;
	}

}
